// Reading characters using the read method of the System.in object
import java.io.IOException;
import java.util.Scanner;

public class ReadCharacters4 {
    public static void main(String[] args) {
    	Scanner scanner = new Scanner(System.in);
    	char ch1, ch2;
        try{
            System.out.println("Enter a single character: ");
            ch1 = (char) System.in.read();
            scanner.nextLine();   // dummy read to remove \n or \r\n from the input buffer
            System.out.println("Enter another single character: ");
            ch2 = (char) System.in.read();
            System.out.println("It is " + (ch1 == ch2) + " that " + ch1 + " equals " + ch2 + ".");
        }catch(IOException e){
           System.out.println(e);
        }
    }
}
